package com.amazon.inapp.purchasing;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import java.util.Set;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

final class SandboxRequestHandler
  implements RequestHandler
{
  private static final String TAG = "SandboxRequestHandler";

  public void sendContentDownloadRequest(String paramString1, String paramString2, String paramString3)
  {
  }

  public void sendGetUserIdRequest(String paramString)
  {
    if (Logger.isTraceOn())
      Logger.trace("SandboxRequestHandler", "sendGetUserIdRequest");
    try
    {
      Bundle localBundle = new Bundle();
      JSONObject localJSONObject = new JSONObject();
      localJSONObject.put("requestId", paramString);
      localJSONObject.put("packageName", PurchasingManager.getObserverContext().getPackageName());
      localBundle.putString("userInput", localJSONObject.toString());
      Intent localIntent = new Intent("com.amazon.testclient.iap.appUserId");
      localIntent.addFlags(268435456);
      localIntent.putExtras(localBundle);
      PurchasingManager.getObserverContext().startService(localIntent);
      return;
    }
    catch (JSONException localJSONException)
    {
      Logger.error("SandboxRequestHandler", "Error in sendGetUserIdRequest.");
    }
  }

  public void sendItemDataRequest(Set<String> paramSet, String paramString)
  {
    if (Logger.isTraceOn())
      Logger.trace("SandboxRequestHandler", "sendItemDataRequest");
    try
    {
      Bundle localBundle = new Bundle();
      JSONObject localJSONObject = new JSONObject();
      JSONArray localJSONArray = new JSONArray(paramSet);
      localJSONObject.put("requestId", paramString);
      localJSONObject.put("packageName", PurchasingManager.getObserverContext().getPackageName());
      localJSONObject.put("skus", localJSONArray);
      localBundle.putString("itemDataInput", localJSONObject.toString());
      Intent localIntent = new Intent("com.amazon.testclient.iap.itemData");
      localIntent.addFlags(268435456);
      localIntent.putExtras(localBundle);
      PurchasingManager.getObserverContext().startService(localIntent);
      return;
    }
    catch (JSONException localJSONException)
    {
      Logger.error("SandboxRequestHandler", "Error in sendItemDataRequest.");
    }
  }

  public void sendPurchaseRequest(String paramString1, String paramString2)
  {
    if (Logger.isTraceOn())
      Logger.trace("SandboxRequestHandler", "sendPurchaseRequest");
    try
    {
      Bundle localBundle = new Bundle();
      JSONObject localJSONObject = new JSONObject();
      localJSONObject.put("sku", paramString1);
      localJSONObject.put("requestId", paramString2);
      localJSONObject.put("packageName", PurchasingManager.getObserverContext().getPackageName());
      localBundle.putString("purchaseInput", localJSONObject.toString());
      Intent localIntent = new Intent("com.amazon.testclient.iap.purchase");
      localIntent.addFlags(268435456);
      localIntent.putExtras(localBundle);
      PurchasingManager.getObserverContext().startService(localIntent);
      return;
    }
    catch (JSONException localJSONException)
    {
      Logger.error("SandboxRequestHandler", "Error in sendPurchaseRequest.");
    }
  }

  public void sendPurchaseResponseReceivedRequest(String paramString)
  {
  }

  public void sendPurchaseUpdatesRequest(Offset paramOffset, String paramString)
  {
    if (Logger.isTraceOn())
      Logger.trace("SandboxRequestHandler", "sendPurchaseUpdatesRequest");
    try
    {
      Bundle localBundle = new Bundle();
      JSONObject localJSONObject = new JSONObject();
      localJSONObject.put("requestId", paramString);
      localJSONObject.put("packageName", PurchasingManager.getObserverContext().getPackageName());
      localJSONObject.put("offset", paramOffset.toString());
      localBundle.putString("purchaseUpdatesInput", localJSONObject.toString());
      Intent localIntent = new Intent("com.amazon.testclient.iap.purchaseUpdates");
      localIntent.addFlags(268435456);
      localIntent.putExtras(localBundle);
      PurchasingManager.getObserverContext().startService(localIntent);
      return;
    }
    catch (JSONException localJSONException)
    {
      Logger.error("SandboxRequestHandler", "Error in sendPurchaseUpdatesRequest.");
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.amazon.inapp.purchasing.SandboxRequestHandler
 * JD-Core Version:    0.6.2
 */